<?php
/**
 * The template used for displaying page content in page.php
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */
?>
<div class="leftpage aleft">
	<?php
		if(has_post_thumbnail(21)) { echo get_the_post_thumbnail(21, 'page-thumb');
		} else { ?>
				<img src="<?php echo get_template_directory_uri(); ?>/images/page-thumb.jpg" alt="<?php the_title();?>"/>
	<?php } //endif?>
	<div id="search_event">
	
	<link rel='stylesheet' href="<?php echo bloginfo("stylesheet_directory"); ?>/jqueryui/css/redmond/jquery-ui-1.8.24.custom.css" TYPE="text/css">
		<script>
		jQuery(function() {
			jQuery( "#startdate" ).datepicker({autoSize:false});
			jQuery( "#enddate" ).datepicker({autoSize:false});
		});
		</script>
		<img width="210" height="19" border="0" alt="events calendar" src="<?php echo get_template_directory_uri(); ?>/images/events_search_table.gif">
		<div id="innersearch">
			1. Search By Event Name
			<form action="<?php echo home_url('eventscalendar'); ?>" method="GET" id="searchbyname">
			<script>
			jQuery(function() {
				jQuery('#searchbyname').submit(function() {
					if(jQuery("#eventname").val() == "")
					{
						alert('Incorect search string.');
						return false;
					}
				});
			});
			</script>
				<input type="text" id="eventname" name="eventname" value="<?php if($_REQUEST['eventname']) echo $_REQUEST['eventname'];?>"/>
				<input type="submit" value="submit" />
			</form>
			<form action="<?php echo home_url('eventscalendar'); ?>" method="GET" id="searchbydate">
			<script>
			jQuery(function() {
				jQuery('#searchbydate').submit(function() {
					if(jQuery("#startdate").val() == "" || jQuery("#enddate").val() == "")
					{
						alert('Please fill Start and End date to search.');
						return false;
					} else
					{
						var begin = new Date(jQuery("#startdate").val());
						var end = new Date(jQuery("#enddate").val());
						if(begin > end)
						{
							alert('The start date cannot be after the end date.');
							return false;
						}
					}
					
				});
			});
			</script>
				2. Search By Date <br />
				Start: <br />
				<input type="text" name="startdate" id="startdate" value="<?php if($_REQUEST['startdate']) echo $_REQUEST['startdate']; ?>"/>
				End: <br />
				<input type="text" name="enddate" id="enddate" value="<?php if($_REQUEST['enddate']) echo $_REQUEST['enddate']; ?>"/>
				<input type="submit" value="submit" />
			</form>
		</div>
	</div>
	<div id="print18months">
		<a href="<?php echo home_url(''); ?>/eventscalendar18months" target="_blank">Print 18-Month Calendar</a>
	</div>
</div><!--/.leftpage-->

<div class="mainpage aleft">

	<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
		<header class="entry-header">
			<h1 class="entry-title">Events Calendar</h1>
		</header><!-- .entry-header -->
	
		<div class="entry-content">
				<p>
				<img alt="Arrow" src="<?php echo bloginfo("stylesheet_directory"); ?>/images/arrow_back.gif">&nbsp;<a href="<?php echo home_url(''); ?>/eventscalendar/">Back To Events List</a>
				</p>				
				<br/>
				<div id="events">
				<h2 class="hd-tb">Event Information</h2>
				<div class="bd-tb">
							<table class="eventdetals" style="width: 100%">
								<tr>
									<td style="width: 70%" class="event-title"><?php the_title(); ?></td>
								</tr>
								<tr>
									<td style="width: 70%"><b>Date: </b><?php echo date('m/d/Y', get_post_meta(get_the_ID(), 'begindate', true)).' - '.date('m/d/Y', get_post_meta(get_the_ID(), 'enddate', true)); ?></td>
									<td style="width: 30%; text-align: right;"><?php if(get_post_meta(get_the_ID(), 'isprivate', true)) echo 'This is a Private Event.'; else echo 'This is a Public Event.' ?></td>
								</tr>
								<tr><td colspan="2"><div class="line-tb" style="margin: 3px 0;"></div></td></tr>
								<tr>
									<td colspan="2">
									<b>Type: </b><?php echo get_post_meta(get_the_ID(), 'type', true);?>
									</td>
								</tr>
								<tr><td colspan="2"><div class="line-tb" style="margin: 3px 0;"></div></td></tr>
								<tr>
									<td colspan="2">
									<b>Attendance: </b><?php echo get_post_meta(get_the_ID(), 'attendance', true);?>
									</td>
								</tr>
								<tr><td colspan="2"><div class="line-tb" style="margin: 3px 0;"></div></td></tr>
								<tr>
									<td colspan="2">
									<b>Event Web Site: </b> <a href="<?php echo get_post_meta(get_the_ID(), 'website', true);?>"><?php echo get_post_meta(get_the_ID(), 'website', true);?></a>
									</td>
								</tr>
								<?php if($post->post_content != ""): ?>
								<tr><td colspan="2"><div class="line-tb" style="margin: 3px 0;"></div></td></tr>
								<tr>
									<td colspan="2"><?php the_content(); ?></td>
								</tr>
								<? endif;  ?>
								
							</table>
							
				</div>
				</div> <!-- events -->
			</div><!-- .entry-content -->
		<div style="clear:both"></div>
		<!-- .entry-meta -->
	</article><!-- #post-<?php the_ID(); ?> -->
</div><!--/.mainrpage-->
